import React, {useEffect, useState} from 'react';
import {
  View,
  Text,
  TouchableOpacity,
  ActivityIndicator,
  FlatList,
  Image,
  ScrollView,
} from 'react-native';
import {useNavigation} from '@react-navigation/native';
import AreaView from '../../components/Layout/AreaView';
import styles from './style';
import Banner from '../../components/Banner';
import SearchHeadIcon from '../../components/SearchHeadIcon';
import CouseList from '../../components/CouseList';

const SimulationPaper = () => {
  const navigation = useNavigation();
  const [currentIndex, setCurrentIndex] = useState(0);
  useEffect(() => {
    
  }, [navigation]);
  const tabs = [
    {title: '分类1'},
    {title: '分类2'},
    {title: '分类3'},
    {title: '分类1'},
    {title: '分类2'},
    {title: '分类3'},
    {title: '分类1'},
    {title: '分类2'},
    {title: '分类3'},
  ];
  const onPressList = () => {
    navigation.push('LabelDetail');
  };
  return (
    <AreaView>
      <View style={styles.tab_content}>
        <ScrollView
          showsHorizontalScrollIndicator={false}
          horizontal={true}
          style={styles.tab_container}>
          {tabs?.map((tab, i) => (
            <TouchableOpacity
              style={styles.tab_list}
              activeOpacity={1}
              key={tab.title}
              onPress={() => {
                setCurrentIndex(i);
              }}>
              <Text
                style={[
                  styles.tab_text,
                  // eslint-disable-next-line react-native/no-inline-styles
                  {
                    color: currentIndex === i ? '#EB0029' : '#333333',
                    fontWeight: currentIndex === i ? '600' : '400',
                  },
                ]}>
                {tab.title}
              </Text>
              {currentIndex === i && <View style={styles.line} />}
            </TouchableOpacity>
          ))}
        </ScrollView>
      </View>
      <ScrollView style={styles.list_box}>
        <CouseList onPress={onPressList} />
      </ScrollView>
    </AreaView>
  );
};

export default SimulationPaper;
